//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.ArrayBlockingQueue;
//import java.util.concurrent.BlockingQueue;
//
//public class Demoo1 {
//    import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.ArrayBlockingQueue;
//import java.util.concurrent.BlockingDeque;
//import java.util.concurrent.BlockingQueue;
//
//    class MyThreadPoolExctor{
//        List<Thread> ThreadList = new ArrayList<>();
//        private BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(1000);
//        public MyThreadPoolExctor(int n){
//            for (int i = 0; i < n; i++) {
//                Thread t = new Thread(()->{
//                    while(true){
//                        try {
//                            Runnable runnable = queue.take();
//                            runnable.run();
//                        } catch (InterruptedException e) {
//                            throw new RuntimeException(e);
//                        }
//                    }
//                });
//                t.start();
//                ThreadList.add(t);
//            }
//        }
//        public void submit(Runnable runnable) throws InterruptedException {
//            queue.put(runnable);
//        }
//    }
//    public class ThreadDemo3 {
//        public static void main(String[] args) throws InterruptedException {
//            MyThreadPoolExctor myThreadPoolExctor = new MyThreadPoolExctor(2);
//            for (int i = 0; i < 1000; i++) {
//                int n = i ;
//                myThreadPoolExctor.submit(new Runnable() {
//                    @Override
//                    public void run() {
//                        System.out.println("执行线程"+n+Thread.currentThread().getName());
//                    }
//                });
//            }
//        }
//    }
//
//}
